#coding=utf-8

from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
    (r'^$', '{{ project_name }}.views.index'),
##  (r'^test_syntax_colorize$', '{{ project_name }}.apps.syntax_colorize.index'),
##   google gears support 
    (r'^gears-manifest$', '{{ project_name }}.views.gears_manifest'),
    (r'^gears$', '{{ project_name }}.views.gears_manifest'),
    (r'^gears/$', direct_to_template, {'template': 'gears.html'}),
)

if settings.DEBUG:

    def _get_django_admin_media_root():
        import django
        import os
        return os.path.join(os.path.dirname(django.__file__), 'contrib', 'admin', 'media')

    urlpatterns += patterns('',
        (r'^media/admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': _get_django_admin_media_root(),
        'show_indexes': True, }),
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
   )
